package service

import (
	dom "a-common/domain"
	"a-system/dao"
	"a-system/domain/entity"
	"sync"
)

var (
	noticeServiceTemp *NoticeService
	sysNoticeDao      = dao.NewSysNoticeDao()
	noticeServiceOnce sync.Once
)

type NoticeService struct{}

func NewSysNoticeService() *NoticeService {
	noticeServiceOnce.Do(func() {
		noticeServiceTemp = &NoticeService{}
	})
	return noticeServiceTemp
}

// List 列表
func (m *NoticeService) List(args *entity.SysNoticeDto) (dom.PageVo, error) {
	return sysNoticeDao.List(args)
}

// Get 查
func (m *NoticeService) Get(id string) (entity.SysNoticePageVo, error) {
	return sysNoticeDao.Get(id)
}

// Add 增
func (m *NoticeService) Add(args *entity.SysNoticeDto) (int64, error) {
	return sysNoticeDao.Add(args)
}

// Edit 改
func (m *NoticeService) Edit(args *entity.SysNoticeDto) (int64, error) {
	return sysNoticeDao.Edit(args)
}

// Del 删
func (m *NoticeService) Del(ids string) (int64, error) {
	return sysNoticeDao.Del(ids)
}
